package com.aspose.cells;

import java.util.ArrayList;
import java.util.Iterator;

class zaui {
   private float u;
   boolean a;
   boolean b;
   protected com.aspose.cells.b.a.b.zq c;
   protected float d;
   protected float e;
   protected float f;
   private float v;
   private float w;
   private Color x;
   private int y;
   private int z;
   protected com.aspose.cells.b.a.b.zc g;
   protected com.aspose.cells.b.a.b.zc h;
   protected com.aspose.cells.b.a.b.zc i;
   protected com.aspose.cells.b.a.b.zc j;
   protected com.aspose.cells.b.a.b.zc k;
   protected com.aspose.cells.b.a.b.zm l;
   protected com.aspose.cells.b.a.b.zo m;
   protected com.aspose.cells.b.a.b.zo n;
   protected com.aspose.cells.b.a.b.zo o;
   protected com.aspose.cells.b.a.b.zo p;
   protected com.aspose.cells.b.a.b.zo q;
   protected com.aspose.cells.b.a.b.zo r;
   protected zavw s;
   protected zavw t;
   private String A;
   private boolean B;
   private static float C = 20.0F;
   private zje D;

   protected zaui() {
      this.a = false;
      this.b = false;
      this.x = Color.getEmpty();
      this.y = 0;
      this.z = 0;
      this.g = null;
      this.h = null;
      this.i = null;
      this.j = null;
      this.k = null;
      this.l = null;
      this.s = zavw.a;
      this.t = zavw.a;
      this.B = false;
      this.D = null;
   }

   public zaui(float var1, float var2, float var3, float var4, float var5, float var6, float var7, Color var8, int var9, int var10) {
      this();
      this.v = var6;
      this.w = var7;
      this.x = var8;
      this.y = var9;
      this.z = var10;
      Color var11 = zsa.a(var10, var8);
      this.l = new com.aspose.cells.b.a.b.zm(var11);
      this.l.e(2);
      this.c(var1, var2, var3, var4, var5);
   }

   public zaui(float var1, float var2, float var3, float var4, float var5, float var6, float var7, Color var8, int var9, int var10, float var11, zje var12) {
      this(var1, var2, var3, var4, var5, var6, var7, var8, var9, var10, var11);
      this.D = var12;
      if (var12 != null) {
         com.aspose.cells.b.a.b.zq var13 = new com.aspose.cells.b.a.b.zq(var1, var2, var3, var4);
         com.aspose.cells.b.a.b.a.ze var14 = new com.aspose.cells.b.a.b.a.ze();
         var14.b(var13);
         this.l = var12.k().b(var14);
      }

   }

   public zaui(com.aspose.cells.b.a.b.zq var1, float var2, float var3, float var4, Color var5, int var6, int var7, float var8, zje var9) {
      this(var1.f(), var1.g(), var1.h(), var1.i(), var2, var3, var4, var5, var6, var7, var8, var9);
   }

   public zaui(float var1, float var2, float var3, float var4, float var5, float var6, float var7, Color var8, int var9, int var10, float var11) {
      this(var1, var2, var3, var4, var5, var6, var7, var8, var9, var10);
      this.l.b(var11);
   }

   protected void finalize() throws Exception {
      this.a(false);
   }

   public void a() {
      this.a(true);
      com.aspose.cells.b.a.zg.a(this);
   }

   protected void a(boolean var1) {
      if (!this.B) {
         if (var1) {
            this.l.a();
            this.n();
            this.s.a();
            this.t.a();
         }

         this.B = true;
      }

   }

   public Object b() {
      zaui var1 = new zaui(this.j(), this.k(), this.c(), this.d(), this.x, this.y, this.z, this.l.p(), this.D);
      return var1;
   }

   public zaui a(float var1) {
      zaui var2 = new zaui(this.j(), this.k(), this.v + var1, this.w, this.x, this.y, this.z, this.l.p(), this.D);
      return var2;
   }

   public float c() {
      return this.e;
   }

   public float d() {
      return this.f;
   }

   public float e() {
      return this.u;
   }

   public void b(float var1) {
      this.u = var1;
   }

   public float f() {
      return (this.e + this.f) % 360.0F;
   }

   float g() {
      return this.v;
   }

   float h() {
      return this.w;
   }

   public String i() {
      return this.A;
   }

   public void a(String var1) {
      this.A = var1;
   }

   public com.aspose.cells.b.a.b.zo a(float var1, float[] var2) {
      com.aspose.cells.b.a.b.zo var3 = com.aspose.cells.b.a.b.zo.a();
      if (this.d() >= 180.0F) {
         var2[0] = this.e(this.c()) + this.d() / 2.0F;
         var3 = this.b(this.m.d(), this.m.e(), this.c.h() * var1, this.c.i() * var1, var2[0]);
      } else {
         float var4 = (this.o.d() + this.q.d()) / 2.0F;
         float var5 = (this.o.e() + this.q.e()) / 2.0F;
         float var6 = (float)(Math.atan2((double)(var5 - this.m.e()), (double)(var4 - this.m.d())) * 180.0D / 3.141592653589793D);
         var2[0] = this.e(var6);
         var3 = this.b(this.m.d(), this.m.e(), this.c.h() * var1, this.c.i() * var1, var2[0]);
      }

      var2[0] %= 360.0F;
      if (var2[0] < 0.0F) {
         var2[0] += 360.0F;
      }

      return var3;
   }

   com.aspose.cells.b.a.b.zq j() {
      return this.c;
   }

   float k() {
      return this.d;
   }

   void a(zn var1) {
      this.e(var1);
      if (this.c() > 90.0F && this.c() < 270.0F) {
         this.c(var1);
         this.b(var1);
      } else {
         this.b(var1);
         this.c(var1);
      }

      this.d(var1);
   }

   zaui[] c(float var1) {
      if (this.c() != var1 && this.f() != var1) {
         this.d(var1);
         float var3 = this.e(this.c());
         float var4 = (var1 - var3 + 360.0F) % 360.0F;
         zaui var5 = new zaui(this.j(), this.k(), var3, var4, this.x, this.y, this.z, this.l.p(), this.D);
         var5.b(this.d());
         var5.a = true;
         if (this.d() == 360.0F) {
            var5.a(false, false);
         } else {
            var5.a(true, false);
         }

         var4 = this.e(this.f()) - var1;
         zaui var6 = new zaui(this.j(), this.k(), var1, var4, this.x, this.y, this.z, this.l.p(), this.D);
         var6.b(this.d());
         var6.a = true;
         if (this.d() == 360.0F) {
            var6.a(false, false);
         } else {
            var6.a(false, true);
         }

         return new zaui[]{var5, var6};
      } else {
         return new zaui[]{(zaui)this.b()};
      }
   }

   void a(float var1, float var2, float var3, float var4, float var5) {
      this.c(var1, var2, var3, var4, var5);
   }

   void b(zn var1) {
      if (this.s != null) {
         if (this.c() > 90.0F && this.c() < 270.0F) {
            this.s.a(var1, this.l, this.i, this.D);
         } else {
            this.s.a(var1, this.l, this.g, this.D);
         }
      }

   }

   void c(zn var1) {
      if (this.t != null) {
         if (this.f() > 90.0F && this.f() < 270.0F) {
            this.t.a(var1, this.l, this.g, this.D);
         } else {
            this.t.a(var1, this.l, this.j, this.D);
         }
      }

   }

   void d(zn var1) {
      zaui.za[] var2 = this.p();
      zaui.za[] var3 = var2;
      int var4 = var2.length;

      for(int var5 = 0; var5 < var4; ++var5) {
         zaui.za var6 = var3[var5];
         this.a(var1, this.l, this.k, var6.a(), var6.b(), var6.c(), var6.d());
      }

   }

   void e(zn var1) {
      zaui.za[] var2 = this.q();
      zaui.za[] var3 = var2;
      int var4 = var2.length;

      for(int var5 = 0; var5 < var4; ++var5) {
         zaui.za var6 = var3[var5];
         this.a(var1, this.l, this.g, var6.a(), var6.b(), var6.c(), var6.d());
      }

   }

   void f(zn var1) {
      com.aspose.cells.b.a.b.zc var2 = this.g;
      com.aspose.cells.b.a.b.zm var3 = this.l;
      com.aspose.cells.b.a.b.a.ze var4;
      if (this.D != null) {
         var4 = new com.aspose.cells.b.a.b.a.ze();
         var4.b(this.c.f(), this.c.g(), this.c.h(), this.c.i(), this.e, this.f);
         this.D.i().a(var4);
      }

      if (this.D != null) {
         var4 = new com.aspose.cells.b.a.b.a.ze();
         if (this.f == 360.0F) {
            var4.a(this.c.f(), this.c.g(), this.c.h(), this.c.i(), this.e, this.f);
         } else {
            var4.b(this.c.f(), this.c.g(), this.c.h(), this.c.i(), this.e, this.f);
         }

         this.D.k().a(var4);
      }

   }

   void g(zn var1) {
      com.aspose.cells.b.a.b.zc var2 = this.g;
      com.aspose.cells.b.a.b.zm var3 = this.l;
      com.aspose.cells.b.a.b.zc var4 = null;
      com.aspose.cells.b.a.b.a.ze var5;
      if (this.D != null) {
         var5 = new com.aspose.cells.b.a.b.a.ze();
         var5.b(this.c.f(), this.c.g(), this.c.h(), this.c.i(), this.e, this.f);
         var4 = this.D.i().b(var5);
         this.D.i().a(var5);
      }

      if (this.D != null) {
         var5 = new com.aspose.cells.b.a.b.a.ze();
         if (this.f == 360.0F) {
            var5.a(this.c.f(), this.c.g(), this.c.h(), this.c.i(), this.e, this.f);
         } else {
            var5.b(this.c.f(), this.c.g(), this.c.h(), this.c.i(), this.e, this.f);
         }

         if (this.D.k().b(var5).c().getA() != 0) {
            this.D.k().a(var5);
         } else if (var4 != null) {
            com.aspose.cells.b.a.b.zm var6 = new com.aspose.cells.b.a.b.zm(var4, 1.0F);
            if (var6 != null) {
               var6.r();
            }
         }
      }

   }

   com.aspose.cells.b.a.b.zq l() {
      com.aspose.cells.b.a.b.zq var1 = new com.aspose.cells.b.a.b.zq(this.o.d(), this.o.e(), 0.0F, 0.0F);
      com.aspose.cells.b.a.b.zq[] var2;
      if (this.e == 0.0F || this.e + this.f >= 360.0F) {
         var2 = new com.aspose.cells.b.a.b.zq[]{var1};
         zadg.a(var2, this.c.l());
         var1 = var2[0];
      }

      if (this.e <= 90.0F && this.e + this.f >= 90.0F || this.e + this.f >= 450.0F) {
         var2 = new com.aspose.cells.b.a.b.zq[]{var1};
         zadg.b(var2, this.c.m() + this.k());
         var1 = var2[0];
      }

      if (this.e <= 180.0F && this.e + this.f >= 180.0F || this.e + this.f >= 540.0F) {
         var2 = new com.aspose.cells.b.a.b.zq[]{var1};
         zadg.a(var2, this.c.j());
         var1 = var2[0];
      }

      if (this.e <= 270.0F && this.e + this.f >= 270.0F || this.e + this.f >= 630.0F) {
         var2 = new com.aspose.cells.b.a.b.zq[]{var1};
         zadg.b(var2, this.c.k());
         var1 = var2[0];
      }

      var2 = new com.aspose.cells.b.a.b.zq[]{var1};
      zadg.a(var2, this.m);
      var1 = var2[0];
      var2[0] = var1;
      zadg.a(var2, this.n);
      var1 = var2[0];
      var2[0] = var1;
      zadg.a(var2, this.o);
      var1 = var2[0];
      var2[0] = var1;
      zadg.a(var2, this.p);
      var1 = var2[0];
      var2[0] = var1;
      zadg.a(var2, this.q);
      var1 = var2[0];
      var2[0] = var1;
      zadg.a(var2, this.r);
      var1 = var2[0];
      return var1;
   }

   zje m() {
      return this.D;
   }

   protected void a(Color var1, int var2) {
      this.g = new com.aspose.cells.b.a.b.zu(var1);
      this.h = new com.aspose.cells.b.a.b.zu(zkm.a(var1, zkm.a));
      switch(var2) {
      case 0:
         Color var3 = Color.fromArgb((var1.getR() & 255) / 2, (var1.getG() & 255) / 2, (var1.getB() & 255) / 2);
         this.i = this.j = this.k = new com.aspose.cells.b.a.b.zu(var3);
         break;
      case 1:
         this.i = this.j = this.k = new com.aspose.cells.b.a.b.zu(zkm.a(var1, -zkm.a));
         break;
      case 2:
         double var4 = (double)(this.e - 180.0F - C);
         if (var4 < 0.0D) {
            var4 += 360.0D;
         }

         this.i = this.a(var1, var4);
         var4 = (double)(this.e + this.f - C);
         if (var4 < 0.0D) {
            var4 += 360.0D;
         }

         this.j = this.a(var1, var4);
         this.k = this.a(var1);
      }

   }

   protected void n() {
      this.g.h();
      this.i.h();
      this.j.h();
      this.k.h();
      this.h.h();
   }

   protected com.aspose.cells.b.a.b.zc a(Color var1, double var2) {
      return new com.aspose.cells.b.a.b.zu(zkm.a(var1, -((float)((double)zkm.a * (1.0D - 0.8D * Math.cos(var2 * 3.141592653589793D / 180.0D))))));
   }

   protected com.aspose.cells.b.a.b.zc a(Color var1) {
      com.aspose.cells.b.a.b.a.zc var2 = new com.aspose.cells.b.a.b.a.zc();
      var2.a(new Color[]{zkm.a(var1, -zkm.a / 2.0F), var1, zkm.a(var1, -zkm.a)});
      var2.a(new float[]{0.0F, 0.1F, 1.0F});
      com.aspose.cells.b.a.b.a.zh var3 = new com.aspose.cells.b.a.b.a.zh(this.c, Color.getBlue(), Color.getWhite(), 0);
      var3.a(var2);
      return var3;
   }

   protected void a(zn var1, com.aspose.cells.b.a.b.zm var2, com.aspose.cells.b.a.b.zc var3, float var4, float var5, com.aspose.cells.b.a.b.zo var6, com.aspose.cells.b.a.b.zo var7) {
      float var8 = 0.5F;
      if (this.D != null) {
         com.aspose.cells.b.a.b.a.ze var9 = this.b(var4, var5, var6, var7);
         if (this.a) {
            com.aspose.cells.b.a.b.a.ze var10 = this.a(var4, var5, var6, var7);
            this.D.i().a(var9, var8, var10);
         } else {
            this.D.i().a(var9, var8);
         }
      }

      if (this.D != null) {
         ArrayList var13 = this.a(var4, var5, var6, var7, this.e());
         Iterator var12 = var13.iterator();

         while(var12.hasNext()) {
            com.aspose.cells.b.a.b.a.ze var11 = (com.aspose.cells.b.a.b.a.ze)var12.next();
            this.D.k().a(var11);
         }
      }

   }

   protected float d(float var1) {
      double var2 = (double)this.c.h() * Math.cos((double)var1 * 3.141592653589793D / 180.0D);
      double var4 = (double)this.c.i() * Math.sin((double)var1 * 3.141592653589793D / 180.0D);
      float var6 = (float)(Math.atan2(var4, var2) * 180.0D / 3.141592653589793D);
      return var6 < 0.0F ? var6 + 360.0F : var6;
   }

   protected float e(float var1) {
      double var2 = (double)this.c.i() * Math.cos((double)var1 * 3.141592653589793D / 180.0D);
      double var4 = (double)this.c.h() * Math.sin((double)var1 * 3.141592653589793D / 180.0D);
      float var6 = (float)(Math.atan2(var4, var2) * 180.0D / 3.141592653589793D);
      return var6 < 0.0F ? var6 + 360.0F : var6;
   }

   protected com.aspose.cells.b.a.b.zo b(float var1, float var2, float var3, float var4, float var5) {
      double var6 = (double)var5 * 3.141592653589793D / 180.0D;
      return new com.aspose.cells.b.a.b.zo(var1 + (float)((double)var3 * Math.cos(var6)), var2 + (float)((double)var4 * Math.sin(var6)));
   }

   private void c(float var1, float var2, float var3, float var4, float var5) {
      this.c = new com.aspose.cells.b.a.b.zq(var1, var2, var3, var4);
      this.d = var5;
      this.e = this.d(this.v);
      this.f = this.w;
      if (this.f % 180.0F != 0.0F) {
         this.f = this.d(this.v + this.w) - this.e;
      }

      if (this.f < 0.0F) {
         this.f += 360.0F;
      }

      this.a(this.x, this.y);
      float var6 = var1 + var3 / 2.0F;
      float var7 = var2 + var4 / 2.0F;
      this.m = new com.aspose.cells.b.a.b.zo(var6, var7);
      this.n = new com.aspose.cells.b.a.b.zo(var6, var7 + var5);
      this.o = this.b(var6, var7, var3 / 2.0F, var4 / 2.0F, this.v);
      this.p = new com.aspose.cells.b.a.b.zo(this.o.d(), this.o.e() + var5);
      this.q = this.b(var6, var7, var3 / 2.0F, var4 / 2.0F, this.v + this.w);
      this.r = new com.aspose.cells.b.a.b.zo(this.q.d(), this.q.e() + var5);
      this.o();
   }

   private void o() {
      this.a(true, true);
   }

   private void a(boolean var1, boolean var2) {
      if (var1) {
         this.s = new zavw(this.m, this.o, this.p, this.n, this.f != 180.0F);
      } else {
         this.s = zavw.a;
      }

      if (var2) {
         this.t = new zavw(this.m, this.q, this.r, this.n, this.f != 180.0F);
      } else {
         this.t = zavw.a;
      }

   }

   private zaui.za[] p() {
      ArrayList var1 = new ArrayList();
      if (this.f != 0.0F && (this.e < 180.0F || this.e + this.f > 360.0F)) {
         float var2;
         com.aspose.cells.b.a.b.zo var3;
         float var4;
         com.aspose.cells.b.a.b.zo var5;
         if (this.c() < 180.0F) {
            var2 = this.e;
            var3 = new com.aspose.cells.b.a.b.zo(this.o.d(), this.o.e());
            var4 = this.f();
            var5 = new com.aspose.cells.b.a.b.zo(this.q.d(), this.q.e());
            if (this.e + this.f > 180.0F) {
               var4 = 180.0F;
               var5.a(this.c.f());
               var5.b(this.m.e());
            }

            com.aspose.cells.b.a.a.ze.a(var1, (Object)(new zaui.za(var2, var4, var3, var5)));
         }

         if (this.e + this.f > 360.0F) {
            var2 = 0.0F;
            var3 = new com.aspose.cells.b.a.b.zo(this.c.l(), this.m.e());
            var4 = this.f();
            var5 = new com.aspose.cells.b.a.b.zo(this.q.d(), this.q.e());
            if (var4 > 180.0F) {
               var4 = 180.0F;
               var5.a(this.c.j());
               var5.b(this.m.e());
            }

            com.aspose.cells.b.a.a.ze.a(var1, (Object)(new zaui.za(var2, var4, var3, var5)));
         }
      }

      return (zaui.za[])((zaui.za[])com.aspose.cells.b.a.a.ze.a(var1, zaui.za.class));
   }

   private zaui.za[] q() {
      ArrayList var1 = new ArrayList();
      if (this.f != 0.0F && (this.e < 0.0F || this.e + this.f > 180.0F) && this.e + this.f > 180.0F) {
         float var2 = this.e;
         com.aspose.cells.b.a.b.zo var3 = new com.aspose.cells.b.a.b.zo(this.o.d(), this.o.e());
         float var4 = this.e + this.f;
         com.aspose.cells.b.a.b.zo var5 = new com.aspose.cells.b.a.b.zo(this.q.d(), this.q.e());
         if (var2 < 180.0F) {
            var2 = 180.0F;
            var3.a(this.c.j());
            var3.b(this.m.e());
         }

         if (var4 > 360.0F) {
            var4 = 360.0F;
            var5.a(this.c.l());
            var5.b(this.m.e());
         }

         com.aspose.cells.b.a.a.ze.a(var1, (Object)(new zaui.za(var2, var4, var3, var5)));
         if (this.e < 360.0F && this.e + this.f > 540.0F) {
            var2 = 180.0F;
            var3 = new com.aspose.cells.b.a.b.zo(this.c.j(), this.m.e());
            var4 = this.f();
            var5 = new com.aspose.cells.b.a.b.zo(this.q.d(), this.q.e());
            com.aspose.cells.b.a.a.ze.a(var1, (Object)(new zaui.za(var2, var4, var3, var5)));
         }
      }

      return (zaui.za[])((zaui.za[])com.aspose.cells.b.a.a.ze.a(var1, zaui.za.class));
   }

   private com.aspose.cells.b.a.b.a.ze a(float var1, float var2, com.aspose.cells.b.a.b.zo var3, com.aspose.cells.b.a.b.zo var4) {
      com.aspose.cells.b.a.b.a.ze var5 = new com.aspose.cells.b.a.b.a.ze();
      var5.a(this.c, var1, this.e());
      var5.a(this.c.f(), this.c.g() + this.d, this.c.h(), this.c.i(), var2, -this.e());
      return var5;
   }

   private com.aspose.cells.b.a.b.a.ze b(float var1, float var2, com.aspose.cells.b.a.b.zo var3, com.aspose.cells.b.a.b.zo var4) {
      com.aspose.cells.b.a.b.a.ze var5 = new com.aspose.cells.b.a.b.a.ze();
      var5.a(this.c, var1, var2 - var1);
      var5.b(var4.d(), var4.e(), var4.d(), var4.e() + this.d);
      var5.a(this.c.f(), this.c.g() + this.d, this.c.h(), this.c.i(), var2, var1 - var2);
      var5.b(var3.d(), var3.e() + this.d, var3.d(), var3.e());
      var5.i();
      return var5;
   }

   private ArrayList a(float var1, float var2, com.aspose.cells.b.a.b.zo var3, com.aspose.cells.b.a.b.zo var4, float var5) {
      ArrayList var6 = new ArrayList();
      com.aspose.cells.b.a.b.a.ze var7;
      if (var5 != 360.0F) {
         var7 = new com.aspose.cells.b.a.b.a.ze();
         var7.a(this.c, var1, var2 - var1);
         var7.b(var4.d(), var4.e(), var4.d(), var4.e() + this.d);
         var7.a(this.c.f(), this.c.g() + this.d, this.c.h(), this.c.i(), var2, var1 - var2);
         var7.b(var3.d(), var3.e() + this.d, var3.d(), var3.e());
         com.aspose.cells.b.a.a.ze.a(var6, (Object)var7);
      } else {
         var7 = new com.aspose.cells.b.a.b.a.ze();
         var7.a(this.c, var1, var2 - var1);
         com.aspose.cells.b.a.a.ze.a(var6, (Object)var7);
         com.aspose.cells.b.a.b.a.ze var8 = new com.aspose.cells.b.a.b.a.ze();
         var8.a(this.c.f(), this.c.g() + this.d, this.c.h(), this.c.i(), var2, var1 - var2);
         com.aspose.cells.b.a.a.ze.a(var6, (Object)var8);
         int var9 = (int)com.aspose.cells.b.a.zq.a((double)var1, 1);
         if (var9 % 180 == 0) {
            com.aspose.cells.b.a.b.a.ze var10 = new com.aspose.cells.b.a.b.a.ze();
            var10.b(var3.d(), var3.e() + this.d, var3.d(), var3.e());
            com.aspose.cells.b.a.a.ze.a(var6, (Object)var10);
         }

         int var12 = (int)com.aspose.cells.b.a.zq.a((double)var2, 1);
         if (var12 % 180 == 0) {
            com.aspose.cells.b.a.b.a.ze var11 = new com.aspose.cells.b.a.b.a.ze();
            var11.b(var4.d(), var4.e(), var4.d(), var4.e() + this.d);
            com.aspose.cells.b.a.a.ze.a(var6, (Object)var11);
         }
      }

      return var6;
   }

   private final class za {
      private float b;
      private float c;
      private com.aspose.cells.b.a.b.zo d;
      private com.aspose.cells.b.a.b.zo e;

      public za(float var2, float var3, com.aspose.cells.b.a.b.zo var4, com.aspose.cells.b.a.b.zo var5) {
         this.b = var2;
         this.c = var3;
         this.d = var4;
         this.e = var5;
      }

      public float a() {
         return this.b;
      }

      public float b() {
         return this.c;
      }

      public com.aspose.cells.b.a.b.zo c() {
         return this.d;
      }

      public com.aspose.cells.b.a.b.zo d() {
         return this.e;
      }
   }
}
